//
//  VisitorView.swift
//  WB
//
//  Created by leador on 17/3/20.
//  Copyright © 2017年 袁满. All rights reserved.
//

import UIKit

class VisitorView: UIView {

    class func visitorView() -> VisitorView {
        return Bundle.main.loadNibNamed("VisitorView", owner: nil, options: nil)?.first as! VisitorView
    }
    
    //MARK: ---控件的属性---
    @IBOutlet weak var rotationView: UIImageView!
    @IBOutlet weak var iconView: UIImageView!
    @IBOutlet weak var tipLabel: UILabel!
    
    @IBOutlet weak var registerBtn: UIButton!
    @IBOutlet weak var loginBtn: UIButton!
    
    //MARK: ---自定义函数---
    func setupVisitorViewInfo(iconImageName:String,title:String) {
        
        iconView.image = UIImage(named:iconImageName)
        tipLabel.text = title
        rotationView.isHidden = true
        
    }
    
    //MARK: ---添加旋转动画---
    func addRotationAnim() {
        
        let rotationAnim = CABasicAnimation(keyPath: "transform.rotation.z")
        rotationAnim.fromValue = 0
        rotationAnim.toValue = M_PI
        rotationAnim.repeatCount = MAXFLOAT
        rotationAnim.duration = 5
        
        rotationAnim.isRemovedOnCompletion = false
        
        rotationView.layer.add(rotationAnim, forKey: nil)
        
    }
    
    

}
